import createAxios from '/@/utils/axios'

const controllerUrl = '/api/RedemptionCode/'

export const verifyRedemptionCodeApi = (code: string) => {
    return createAxios({
        url: controllerUrl + 'verify',
        method: 'POST',
        data: { code }
    })
}

export const useRedemptionCodeApi = (code: string, resultId: number) => {
    return createAxios({
        url: controllerUrl + 'use',
        method: 'POST',
        data: { code, result_id: resultId }
    })
}

export const getRedemptionHistoryApi = (params: {
    page?: number
    limit?: number
}) => {
    return createAxios({
        url: controllerUrl + 'history',
        method: 'GET',
        params
    })
}

export const batchVerifyRedemptionCodesApi = (codes: string[]) => {
    return createAxios({
        url: controllerUrl + 'batchVerify',
        method: 'POST',
        data: { codes }
    })
}